<?php

/**
 *  经销商商品
 */

namespace app\api\controller;

use app\facade\Basic;
use think\Request;
use app\api\service\DistributorProduct as ServiceDistributorProduct;

class DistributorProduct extends BaseController
{
    /**
     *  供应商列表
     */
    public function list(Request $request)
    {
        $param['user_id'] = $request->user_id;
        $param['role'] = $request->role;
        $param['lang'] = $request->header('think-lang');
        /* 页面 */
        $param['page'] = $request->param('page', 1);
        $param['listRows'] = $request->param('listRows', 1000);

        /* 筛选 */
        $param['brand'] = $request->param('brand', null);
        $param['minable_coin'] = $request->param('minable_coin', null);
        $param['warehouse'] = $request->param('warehouse', null);

        /* 是否二手 */
        $param['condition'] = $request->param('condition', null);

        /* 排序 */
        $param['sort'] = $request->param('sort', 0);

        $param['is_futures'] = $request->param('is_futures', null);
        $param['product_type'] = $request->param('product_type', null);
        $param['action'] = $request->param('action', null);
        $param['keywords'] = $request->param('keywords', null);
        /* 验证 */
        $this->validateData($param, 'DistributorProduct.list');

        /* 商品列表 */
        $ServiceLogin = new ServiceDistributorProduct();
        $result = $ServiceLogin->list($param);
        return Basic::json($result);
    }
}
